from pydantic import BaseModel,Field,field_validator

class LoginModel(BaseModel):
    username: str
    password: str

    @field_validator("password")
    def check_password(cls,value):
        if len(value) < 6:
            raise ValueError("密码长度必须大于6位")
        return value